import requests
headers ={
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
}
url = 'https://www.baidu.com/s?'
name =input("请输入关键字：")
kw = {'kw':name}
res = requests.get(url,headers=headers,params=kw)
res.encoding ='utf-8'
with open('学习强国.txt','wb') as f:
    f.write(res.content)

